﻿//======================================================================
//
//	XNA ContentBrowser
//
//  by Matt Pettineo (mpettineo@gmail.com)
//  05/03/09  
//
//======================================================================

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;

using ContentBrowser;

namespace ContentBrowserSample
{
    public partial class MainFrm : Form
    {
        public MainFrm()
        {
            InitializeComponent();            
        }

        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            // We need to initialize the ContentBrowser before the user can actually use it.
            // Doing it here will show the progress dialog after the main window has already
            // shown up, and will also disable the window so that the user can't interact with it
            // until initialization is finished.
            string exePath = Process.GetCurrentProcess().MainModule.FileName;
            string contentDirectory = Path.GetDirectoryName(exePath) + "\\Content";
            ContentBrowserDialog.Initialize(mainView.Project.ServiceCollection, contentDirectory, this);

            propertyGrid.SelectedObject = mainView.Project;
        }
    }
}
